/*
 * Created by Jaren at 2021/8/18 11:00
 */
import 'dart:typed_data';

// Http请求返回
typedef HttpSuccessCallback = void Function(Uint8ClampedList rsp);
typedef HttpFailCallback = void Function(String errorMsg);

abstract class SendHandler {
  Map<String, HttpSuccessCallback?>? succeedMap;
  Map<String, HttpFailCallback?>? failMap;

  void send(Uint8ClampedList bytes, [String clientId = 'default']);

  void post(
    Uint8ClampedList bytes,
    int? msgId,
    HttpSuccessCallback? httpCallback,
    HttpFailCallback? failCallback, [
    String clientId = 'default',
  ]);
}

class UnknownSendHandler extends SendHandler {
  @override
  void send(Uint8ClampedList bytes, [String clientId = 'default']) {}

  @override
  void post(
    Uint8ClampedList bytes,
    int? msgId,
    HttpSuccessCallback? httpCallback,
    HttpFailCallback? failCallback, [
    String clientId = 'default',
  ]) {}
}
